<HTML><HEAD><TITLE>random_sample(+Values, +SampleSize, -X)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(tentative)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>random_sample(+Values, +SampleSize, -X)</H1>
Nondeterministically pick SampleSize random elements
<DL>
<DT><EM>Values</EM></DT>
<DD>Specification of possible values
</DD>
<DT><EM>SampleSize</EM></DT>
<DD>Integer
</DD>
<DT><EM>X</EM></DT>
<DD>Output variable
</DD>
</DL>
<H2>Description</H2>

	This predicate succeeds SampleSize times. Each time it succeeds,
	it returns a random value from the given specification of possible
	values.  The Values specification are as in random_element/2.
    
<H3>Modes and Determinism</H3><UL>
<LI>random_sample(+, +, -) is nondet
</UL>
<H2>Examples</H2>
<PRE>
    ?- random_sample(0 .. 9, 3, X).
    X = 9
    Yes (0.00s cpu, solution 1, maybe more)
    X = 0
    Yes (0.03s cpu, solution 2, maybe more)
    X = 5
    Yes (0.03s cpu, solution 3)
    </PRE>
<H2>See Also</H2>
<A HREF="../../kernel/arithmetic/random-1.html">random / 1</A>, <A HREF="../../kernel/arithmetic/frandom-1.html">frandom / 1</A>, <A HREF="../../lib/tentative/random_element-2.html">random_element / 2</A>, <A HREF="../../lib/tentative/tent_set_random-2.html">tent_set_random / 2</A>
</BODY></HTML>
